﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Itfort.Web;
using WanPiJie.Products;

namespace WanPiJie.WebSite
{
	public partial class _Default : Itfort.Web.PageBase
	{
		/// <summary>
		/// 当前页码数
		/// </summary>
		public int PageIndex { get { return 1; } }

		/// <summary>
		/// 4的倍数
		/// </summary>
		public int PageSize { get { return 12; } }

		public Int64 CatalogId { get; set; }

        protected IList<Commodity> SalesInfoExpands { get; private set; }

		protected void Page_Load(object sender, EventArgs e)
		{
			this.CatalogId = Request.ToInt64("cid");
		}

		protected override void HttpGetProcess()
		{
			base.HttpGetProcess();

			if (this.CatalogId != 0)
			{
				this.SalesInfoExpands = WpjSf.CommodityService.GetCommodities(this.CatalogId, this.PageIndex, this.PageSize);
			}
			else
			{
				this.SalesInfoExpands = WpjSf.CommodityService.GetCommodities(this.PageIndex, this.PageSize);
			}
			this.Binding();
		}

		/// <summary>
		/// 产品数据信息绑定
		/// </summary>
		private void Binding()
		{
			this.rptProductList.DataSource = this.SalesInfoExpands;
			this.rptProductList.DataBind();
		}

		protected string BoxFirstCssClass(int i)
		{
			if (i % 5 == 1)
			{
				return "first";
			}
			else
			{
				return "";
			}
		}
	}
}